@auto[filespec]
$confdir[^file:dirname[$filespec]] 
$charsetsdir[$confdir/charsets]
$sqldriversdir[$confdir/lib]

$CHARSETS[
    $.koi8-r[$charsetsdir/koi8-r.cfg]
    $.windows-1251[$charsetsdir/windows-1251.cfg]
]

$SQL[
   $.connect-string[mysql://stat:dk23KJUI87jhjew7@[/tmp/mysql.sock]/stat?timeout=100&ClientCharset=windows-1251]
   $.drivers[^table::create{protocol	driver	client
mysql	$sqldriversdir/libparser3mysql.so	libmysqlclient.so
}]
]

$CLASS_PATH[^table::create{path
/../app/classess/
/../app/model/
/../app/controllers/
tests/
/../classess/}]

@unhandled_exception[exception;stack]
  ^setup[]

  ^pfConsole:writeln[]

  ^pfConsole:setColor[white;red]
  ^pfConsole:writeln[Unhandled Exception^if(def $exception.type){ ($exception.type)}]
  ^pfConsole:writeln[]

  ^pfConsole:writeln[  Source: $exception.source]
  ^pfConsole:writeln[ Comment: $exception.comment]

   ^if(def $exception.file){
     ^pfConsole:writeln[   Where: $exception.file (${exception.lineno}:$exception.colno)]
   }
 
   ^if($stack){
     ^pfConsole:writeln[          ---------------------------------------------------------------------]
     ^pfConsole:writeln[]
     ^pfConsole:setColor[white;brown]
     ^pfConsole:writeln[Stack trace:]
     ^stack.menu{
 		   ^pfConsole:writeln[$stack.name | $stack.file^(${stack.lineno}:$stack.colno^)]
 	   }
   }

  ^pfConsole:writeln[]
  
  $result[$pfConsole:stdout]

@setup[]
  $request:charset[utf-8]
  $response:charset[utf-8]

  ^use[pf/io/pfConsole.p]
  ^use[pf/tests/pfAssert.p]

@postprocess[aBody]
  ^if(!$pfConsole:isEmpty){
    $result[$pfConsole:stdout]
  }{
     $result[$aBody]
   }


